﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ERP_RORZE_ORDER.Common.ValueObject;
using ERP_RORZE_ORDER.DBAccess;

namespace ERP_RORZE_ORDER.BizLogic
{
	public class ProductHelper
	{
		private Product obj;

		#region ProductHelper(Product obj)
		public ProductHelper(Product obj)
		{
			ValueObject = obj;
		}
		#endregion

		//
		#region ValueObject
		public Product ValueObject
		{
			get
			{
				return obj;
			}
			set
			{
				obj = value;
			}
		}
		#endregion

		public DataTable GetAll()
		{
			DataTable dt = ProductDAO.GetAll();
			return dt;
		}

        public DataTable GetAll(string storedProcString)
        {
            DataTable dt = ProductDAO.GetAll(storedProcString);
            return dt;
        }
		public DataTable GetOne()
		{
			DataTable dt = ProductDAO.GetOne(ValueObject.ProductID);
			return dt;
		}

		public void LoadOne()
		{
			ValueObject = ProductDAO.LoadOne(ValueObject.ProductID);
		}

		public int Insert()
		{
			int result = ProductDAO.Insert(ValueObject);
			return result;
		}

		public int Update()
		{
			int result = ProductDAO.Update(ValueObject);
			return result;
		}

		public int Delete()
		{
			int result = ProductDAO.Delete(ValueObject);
			return result;
		}
	}
}
